package com.chen.conf;

import com.chen.entity.Klass;
import com.chen.entity.School;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;

import java.util.List;

@Data
@Import(KlassConfiguration.class)
public class SchoolConfiguration {

    private String name = "默认学校名";

    @Autowired
    private KlassConfiguration klassConfiguration;

    @Bean
    public School createSchool(){
        School school = new School();
        school.setName(name);
        school.setKlasses(klassConfiguration.getKlasses());
        return school;
    }

}
